package org.ayachinene.leetcode.problems;

import java.util.Arrays;

public class P1798 {

    static class Solution {
        public int getMaximumConsecutive(int[] coins) {
            // 当前的最大连续整数
            int cur = 0;
            Arrays.sort(coins);
            for (int val : coins) {
                if (val > cur + 1) {
                    break;
                }
                cur += val;
            }
            return cur + 1;
        }
    }
}
